package com.xseagull.scm.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.xseagull.scm.common.ResultData;
import com.xseagull.scm.entity.User;

@FeignClient(name = "xseagull-account", fallback = AccountFeignClientFallback.class)
public interface AccountFeignClient {
    @PostMapping("/user/insert")
    public ResultData insert(@RequestBody User user);
    
    /**
	 * get请求，单个参数,要加@RequestParam注解
	 */
    @GetMapping("/user/getOneParameter")
    public ResultData getOneParameter(@RequestParam("number")int number);
    
    /**
	 * get请求，多个参数,要加@RequestParam注解
	 */
    @GetMapping("/user/getMoreParameter")
    public ResultData getMoreParameter(@RequestParam("number")int number, @RequestParam("name")String name);
    
    /**
	 * get请求，@PathVariable注解
	 */
    @GetMapping("/user/getPathVariable/{number}")
    public ResultData getPathVariable(@PathVariable("number") int number);
    
    /**
	 * post请求，单个参数,要加@RequestParam注解
	 */
    @PostMapping("/user/postOneParameter")
    public ResultData postOneParameter(@RequestParam("number")int number);
    
    /**
	 * post请求，多个参数,要加@RequestParam注解
	 */
    @PostMapping("/user/postMoreParameter")
    public ResultData postMoreParameter(@RequestParam("number")int number, @RequestParam("name")String name);
    
    /**
	 * post请求，@PathVariable注解
	 */
    @PostMapping("/user/postPathVariable/{number}")
    public ResultData postPathVariable(@PathVariable("number") int number);
    
    /**
	 * post请求，参数对象 @RequestBody注解,服务那边也要添加
	 */
    @PostMapping("/user/postObject")
    public ResultData postObject(@RequestBody User user);
}
